Full source code website bán hàng thương mại điện tử gần giống shopee
473.327 lượt xem;
1 <?
2 function GetNewsDate($news)
3 {
4 $arr=array('Chủ nhật','Thứ hai','Thứ ba','Thứ tư','Thứ năm','Thứ sáu','Thứ bảy');
5 $date = strtotime($news['date_added']);
6 return $arr[date('w',$date)].', '.date('d/m/Y',$date);
7 }
8
9 function GetNewsCategoryInfo($id,$status=0)
10 {
11 global $con;
12 $id=killInjection($id);
13 if ($id=="") return false;
14 $result = mysql_query("select * from news_cat and id=$id limit 1",$con);
15 return mysql_fetch_assoc($result);
16 }
17
18 function GetNewsInfo($id,$status=0)
19 {
20 global $con;
21 $id=killInjection($id);
22 if ($id=="") return false;
23 $result = mysql_query("select * from news where status=$status and id=$id limit 1",$con);
24 return mysql_fetch_assoc($result);
25 }
26
27 function GetListNewsCategory($where="1=1",$limit="1000",$status=0)
28 {
29 global $con;
30 $ret=array();
31 $result = mysql_query("select * from news_cat where status=$status and $where order by date desc limit $limit",$con);
32 while (($row=mysql_fetch_assoc($result)))
33 $ret[]=$row;
34 return $ret;
35 }
36
37 function GetListNews($where="1=1",$limit="1000",$status="0")
38 {
39 global $con;
40 $ret=array();
41 $result = mysql_query("select * from news where status=$status and $where order by date desc limit $limit",$con);
42 while (($row=mysql_fetch_assoc($result)))
43 $ret[]=$row;
44 return $ret;
45 }
46
47 function GetSpCategoryInfo($id,$status=0)
48 {
49 global $con;
50 $id=killInjection($id);
51 if ($id=="") return false;
52 $result = mysql_query("select * from newscategories_sp where status=$status and categories_id=$id limit 1",$con);
53 return mysql_fetch_assoc($result);
54 }
55
56 function GetSpInfo($id,$status=0)
57 {
58 global $con;
59 $id=killInjection($id);
60 if ($id=="") return false;
61 $result = mysql_query("select * from news_sp where status=$status and news_id=$id limit 1",$con);
62 return mysql_fetch_assoc($result);
63 }
64
65 function GetListSpCategory($where="1=1",$limit="1000",$status=0)
66 {
67 global $con;
68 $ret=array();
69 $result = mysql_query("select * from newscategories_sp where status=$status and $where order by date_added desc limit $limit",$con);
70 while (($row=mysql_fetch_assoc($result)))
71 $ret[]=$row;
72 return $ret;
73 }
74
75 function GetListSpCategoryAll($id="",$split="==")
76 {
77 global $con;
78 $ret=array();
79 if ($id=="") $id=0;
80 $result = mysql_query("select * from newscategories_sp where parent_id=$id",$con);
81 while (($row=mysql_fetch_assoc($result)))
82 {
83 $ret[]=array($row['categories_id'],($id==0?"":$split).$row['categories_name']);
84 $getsub=GetListSpCategoryAll($row['categories_id'],$split.$split);
85 foreach ($getsub as $sub)
86 $ret[]=array($sub[0],$sub[1]);
87 }
88 return $ret;
89 }
90
91 function GetListSp($where="1=1",$limit="1000",$status="0")
92 {
93 global $con;
94 $ret=array();
95 $result = mysql_query("select * from news_sp where status=$status and $where order by date_added desc limit $limit",$con);
96 while (($row=mysql_fetch_assoc($result)))
97 $ret[]=$row;
98 return $ret;
99 }
100
101
102
103 ?>
2 function GetNewsDate($news)
3 {
4 $arr=array('Chủ nhật','Thứ hai','Thứ ba','Thứ tư','Thứ năm','Thứ sáu','Thứ bảy');
5 $date = strtotime($news['date_added']);
6 return $arr[date('w',$date)].', '.date('d/m/Y',$date);
7 }
8
9 function GetNewsCategoryInfo($id,$status=0)
10 {
11 global $con;
12 $id=killInjection($id);
13 if ($id=="") return false;
14 $result = mysql_query("select * from news_cat and id=$id limit 1",$con);
15 return mysql_fetch_assoc($result);
16 }
17
18 function GetNewsInfo($id,$status=0)
19 {
20 global $con;
21 $id=killInjection($id);
22 if ($id=="") return false;
23 $result = mysql_query("select * from news where status=$status and id=$id limit 1",$con);
24 return mysql_fetch_assoc($result);
25 }
26
27 function GetListNewsCategory($where="1=1",$limit="1000",$status=0)
28 {
29 global $con;
30 $ret=array();
31 $result = mysql_query("select * from news_cat where status=$status and $where order by date desc limit $limit",$con);
32 while (($row=mysql_fetch_assoc($result)))
33 $ret[]=$row;
34 return $ret;
35 }
36
37 function GetListNews($where="1=1",$limit="1000",$status="0")
38 {
39 global $con;
40 $ret=array();
41 $result = mysql_query("select * from news where status=$status and $where order by date desc limit $limit",$con);
42 while (($row=mysql_fetch_assoc($result)))
43 $ret[]=$row;
44 return $ret;
45 }
46
47 function GetSpCategoryInfo($id,$status=0)
48 {
49 global $con;
50 $id=killInjection($id);
51 if ($id=="") return false;
52 $result = mysql_query("select * from newscategories_sp where status=$status and categories_id=$id limit 1",$con);
53 return mysql_fetch_assoc($result);
54 }
55
56 function GetSpInfo($id,$status=0)
57 {
58 global $con;
59 $id=killInjection($id);
60 if ($id=="") return false;
61 $result = mysql_query("select * from news_sp where status=$status and news_id=$id limit 1",$con);
62 return mysql_fetch_assoc($result);
63 }
64
65 function GetListSpCategory($where="1=1",$limit="1000",$status=0)
66 {
67 global $con;
68 $ret=array();
69 $result = mysql_query("select * from newscategories_sp where status=$status and $where order by date_added desc limit $limit",$con);
70 while (($row=mysql_fetch_assoc($result)))
71 $ret[]=$row;
72 return $ret;
73 }
74
75 function GetListSpCategoryAll($id="",$split="==")
76 {
77 global $con;
78 $ret=array();
79 if ($id=="") $id=0;
80 $result = mysql_query("select * from newscategories_sp where parent_id=$id",$con);
81 while (($row=mysql_fetch_assoc($result)))
82 {
83 $ret[]=array($row['categories_id'],($id==0?"":$split).$row['categories_name']);
84 $getsub=GetListSpCategoryAll($row['categories_id'],$split.$split);
85 foreach ($getsub as $sub)
86 $ret[]=array($sub[0],$sub[1]);
87 }
88 return $ret;
89 }
90
91 function GetListSp($where="1=1",$limit="1000",$status="0")
92 {
93 global $con;
94 $ret=array();
95 $result = mysql_query("select * from news_sp where status=$status and $where order by date_added desc limit $limit",$con);
96 while (($row=mysql_fetch_assoc($result)))
97 $ret[]=$row;
98 return $ret;
99 }
100
101
102
103 ?>